package request

import (
	"strings"

	"github.com/gin-gonic/gin"
	"lab.com/define/errorcode"
)

// FileUploadReq return params
type FileUploadReq struct {
	DirType int `json:"dir_type" form:"dir_type" validate:"required" comment:"目录类别"`
}

// CheckInputParams return input params
func (file *FileUploadReq) CheckInputParams(c *gin.Context) error {
	if err := c.ShouldBind(file); err != nil {
		return err
	}

	if errs, err := Validate(file); err != nil {
		return errorcode.New(errorcode.ErrParams, strings.Join(errs, ","), nil)
	}

	return nil
}
